﻿using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;

namespace Stee.CAP8.Communication.HttpClient
{
    internal static class JsonExtension
    {
        public static T ToEntity<T>(this string val)
        {
            return JsonConvert.DeserializeObject<T>(val);
        }
 
        public static string ToJson<T>(this T entity, Formatting formatting = Formatting.None)
        {
            return JsonConvert.SerializeObject(entity, formatting);
        }
    }
}
